<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>添加user</title>
    <link href="${pageContext.request.contextPath}/style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="${pageContext.request.contextPath}/tool/jquery/jquery.min.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/js/public.js"></script>
</head>
<body>
 <div class="mainCon">
  <div class="mCon">
  <div class="mCon_tab">
   <ul>   
    <li><span class="mCon_1cuta">添加 / 修改一个用户</span></li>

   </ul>
  </div>
  <form action="${pageContext.request.contextPath}/admin/securityUser/do_save.action" method="post" onsubmit="return beforeSubmit();">
  <input type="hidden" name="id" value="${empty baseinfo ? 0 : baseinfo.id}" />
  <div class="main_list">
   <div class="inke_list">
    <div class="mCon_1t mCon_2t" style="width:150px"><strong>用户名<font color="red">(系统唯一)</font>：</strong></div>

    <div class="mCon_con mCon_con2"><input type="text" name="username" value="${baseinfo.username}" style="width:40%;height:23px;" onfocus="this.className='int_yewBg'" onblur="this.className=''" /></div>
   </div>
   <div class="inke_list">
	<input type="hidden" name="moduleids" id="moduleids" value="${baseinfo.moduleids}" />
    <div class="mCon_1t mCon_2t"><strong>管理模块：</strong></div>
    <div class="mCon_con mCon_con2" id="checkbox_modules">
    <c:if test="${!empty cbs}">
    <c:forEach items="${cbs}" var="cb">
    	<input type="checkbox" name="modules" value="${cb['cbValue']}" chk="${cb['checked']}" />${cb['cbShow']}
    </c:forEach>
    </c:if>
    
    </div>
   </div>
  </div>
  <div class="scxz">

      <input class="fx1" name="" type="submit" value="保 存" />
      <input class="fx1" type="button" onclick="history.back(-1);" value="返 回" />
  </div>
  </form>
  <div class="clear"></div>
  </div>
  <div class="clear"></div>
 </div>
 <script type="text/javascript">
 $(function(){
	//选中已选checkbox
	$("#checkbox_modules input[name='modules']").each(function(){
 		if ($(this).attr("chk")=="true") {
	 		$(this).attr("checked","checked");
	 	}
 	})
 });
 var beforeSubmit = function(){
 	var checkeds = "";
 	$("#checkbox_modules input[name='modules']").each(function(){
 		if ($(this).attr("checked")) {
 			if(checkeds!="")checkeds = checkeds + ",";
 			checkeds = checkeds + $(this).val();
 		}
 	})
 	if(checkeds == ""){
 		alert("请选择至少一个功能点");
 		return false;	
 	}
 	$("#moduleids").val(checkeds);
 	return true;
 }
 </script>
</body>
</html>


